package solution;

import org.junit.jupiter.api.Test;

public class TopologicalTest {
    @Test
    public void test(){
        //0: [1, 5, 6]
        //1: []
        //2: [0, 3]
        //3: [5]
        //4: []
        //5: [4]
        //6: [4, 9]
        //7: [6]
        //8: [7]
        //9: [10, 11, 12]
        //10: []
        //11: [12]
        //12: []
        Graph<Integer> digraph = new AdjacencyListDigraph<>();
        digraph.addEdge(0, 1);
        digraph.addEdge(0, 5);
        digraph.addEdge(0, 6);
        digraph.addEdge(2, 0);
        digraph.addEdge(2, 3);
        digraph.addEdge(3, 5);
        digraph.addEdge(5, 4);
        digraph.addEdge(6, 4);
        digraph.addEdge(6, 9);
        digraph.addEdge(7, 6);
        digraph.addEdge(8, 7);
        digraph.addEdge(9, 10);
        digraph.addEdge(9, 11);
        digraph.addEdge(9, 12);
        digraph.addEdge(11, 12);

//        digraph.addVertex(1);
//        digraph.addVertex(4);
//        digraph.addVertex(10);
//        digraph.addVertex(12);

        Topological<Integer> topological = new Topological<>(digraph);
        System.out.println(topological.order());
    }

    @Test
    public void test2(){
        //Algorithms/Theoretical CS/Databases/Scientific Computing
        //Introduction to CS/Advanced Programming/Algorithms
        //Advanced Programming/Scientific Computing
        //Scientific Computing/Computational Biology
        //Theoretical CS/Computational Biology/Artificial Intelligence
        //Linear Algebra/Theoretical CS
        //Calculus/Linear Algebra
        //Artificial Intelligence/Neural Networks/Robotics/Machine Learning
        //Machine Learning/Neural Networks
        Graph<String> digraph = new AdjacencyListDigraph<>();
        digraph.addEdge("Algorithms", "Theoretical CS");
        digraph.addEdge("Algorithms", "Databases");
        digraph.addEdge("Algorithms", "Scientific Computing");
        digraph.addEdge("Introduction to CS", "Advanced Programming");
        digraph.addEdge("Introduction to CS", "Algorithms");
        digraph.addEdge("Scientific Computing", "Computational Biology");

        digraph.addEdge("Theoretical CS", "Computational Biology");
        digraph.addEdge("Theoretical CS", "Artificial Intelligence");
        digraph.addEdge("Theoretical CS", "Scientific Computing");
        digraph.addEdge("Linear Algebra", "Theoretical CS");
        digraph.addEdge("Calculus", "Linear Algebra");
        digraph.addEdge("Artificial Intelligence", "Neural Networks");
        digraph.addEdge("Artificial Intelligence", "Robotics");
        digraph.addEdge("Artificial Intelligence", "Machine Learning");

        digraph.addEdge("Machine Learning", "Neural Networks");

        Topological<String> topological = new Topological<>(digraph);
        System.out.println(topological.order());
    }
}
